(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 11.3' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     12909,        351]
NotebookOptionsPosition[     11022,        320]
NotebookOutlinePosition[     11379,        336]
CellTagsIndexPosition[     11336,        333]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell["\<\
*************************************\:968f\:673a\:4fe1\:53f7\:5206\:6790(\
\:7b2c5\:7248) \:674e\:6653\:5cf0*************************************\
\>", "Text",
 CellChangeTimes->{{3.7703877157293267`*^9, 3.770387732699301*^9}, 
   3.770388114644495*^9, {3.7703893000016923`*^9, 3.770389322071745*^9}, {
   3.7705425837572746`*^9, 3.7705425857172785`*^9}, {3.7705427340149918`*^9, 
   3.770542743284354*^9}, {3.7705427952664547`*^9, 3.770542809752963*^9}},
 FontFamily->"Consolas",
 FontSize->16,ExpressionUUID->"1ba9a391-4d02-4abc-aea9-35820373b23b"],

Cell["\<\
=======================================P32 \
\:5b9e\:9a8c1=======================================\
\>", "Text",
 CellChangeTimes->{{3.7705425958585186`*^9, 3.7705426453204403`*^9}, {
  3.770542712446249*^9, 3.770542721955392*^9}},
 FontFamily->"Consolas",
 FontSize->16,ExpressionUUID->"4f6e74e8-eac4-48f5-aa94-2c5337ad9aa8"],

Cell[BoxData[
 RowBox[{"X", "=", 
  RowBox[{"ExponentialDistribution", "[", 
   RowBox[{"1", "/", "2"}], "]"}]}]], "Input",
 CellChangeTimes->{{3.77038774832935*^9, 3.7703877759493623`*^9}, {
   3.7703878326793694`*^9, 3.7703878583594227`*^9}, {3.7703881595245037`*^9, 
   3.770388187244772*^9}, {3.770388218814582*^9, 3.7703882262345495`*^9}, 
   3.7703887072548695`*^9},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[21]:=",ExpressionUUID->"d423477c-4efb-47e7-8a8a-cfc0e79020fb"],

Cell[BoxData[
 RowBox[{"Mean", "[", "X", "]"}]], "Input",
 CellChangeTimes->{{3.7703878709594336`*^9, 3.770387888839455*^9}, 
   3.7703887098848658`*^9},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[22]:=",ExpressionUUID->"b86926e4-2334-4ce1-a42e-df965f9feaaf"],

Cell[BoxData[
 RowBox[{"Variance", "[", "X", "]"}]], "Input",
 CellChangeTimes->{{3.770388241714611*^9, 3.7703882463547325`*^9}, 
   3.770388711334908*^9},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[23]:=",ExpressionUUID->"5bc41594-3027-42fc-94de-33ac95ef205c"],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"PDF", "[", 
    RowBox[{
     RowBox[{"ExponentialDistribution", "[", 
      RowBox[{"1", "/", "2"}], "]"}], ",", "x"}], "]"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", "0", ",", "20"}], "}"}], ",", 
   RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.7703882582246084`*^9, 3.7703883181246414`*^9}, {
  3.7703883760446453`*^9, 3.7703883782846527`*^9}, {3.770388423464683*^9, 
  3.77038848444498*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[24]:=",ExpressionUUID->"559e37d9-a1da-4ca4-90ed-074820f5c2ab"],

Cell["\<\
=======================================P32 \
\:5b9e\:9a8c2=======================================\
\>", "Text",
 CellChangeTimes->{{3.7703887500551076`*^9, 3.7703887533449287`*^9}, {
  3.7703893076417317`*^9, 3.7703893294717517`*^9}, {3.7705426590174217`*^9, 
  3.7705426624848065`*^9}, {3.770542752281435*^9, 3.770542754619978*^9}},
 FontFamily->"Consolas",
 FontSize->16,ExpressionUUID->"5e090374-d7b1-4014-a4b8-3580c62b3afc"],

Cell[BoxData[
 RowBox[{"Plot", "[", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"PDF", "[", 
      RowBox[{
       RowBox[{"NormalDistribution", "[", 
        RowBox[{"0", ",", "1"}], "]"}], ",", "x"}], "]"}], ",", 
     RowBox[{"PDF", "[", 
      RowBox[{
       RowBox[{"NormalDistribution", "[", 
        RowBox[{"2", ",", "3"}], "]"}], ",", "x"}], "]"}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"x", ",", 
     RowBox[{"-", "10"}], ",", "10"}], "}"}], ",", 
   RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.7703887702249594`*^9, 3.770388807024933*^9}, {
  3.7703888663450203`*^9, 3.770388887495183*^9}, {3.7703889423250217`*^9, 
  3.770389035865122*^9}, {3.770389077555162*^9, 3.770389077725157*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[25]:=",ExpressionUUID->"b5384d2f-a3f1-46df-8758-7c4940ac3474"],

Cell["\<\
=======================================P32 \
\:5b9e\:9a8c3=======================================\
\>", "Text",
 CellChangeTimes->{
  3.77038740322375*^9, {3.7703893100817323`*^9, 3.7703893285917463`*^9}, {
   3.7705426666494536`*^9, 3.7705426734195485`*^9}, {3.770542757127349*^9, 
   3.770542759089949*^9}},
 FontFamily->"Consolas",
 FontSize->16,ExpressionUUID->"924d08b1-a02d-45f1-8145-341282083d12"],

Cell[BoxData[
 RowBox[{"f", "=", 
  FractionBox[
   RowBox[{"Exp", "[", 
    RowBox[{
     RowBox[{"-", 
      FractionBox["2", "3"]}], " ", 
     RowBox[{"(", 
      RowBox[{
       SuperscriptBox["x", "2"], "-", 
       FractionBox[
        RowBox[{"x", " ", "y"}], "2"], "+", 
       FractionBox[
        SuperscriptBox["y", "2"], "4"]}], ")"}]}], "]"}], 
   RowBox[{"2", " ", "\[Pi]", " ", 
    SqrtBox["3"]}]]}]], "Input",
 CellChangeTimes->{{3.7703857401726933`*^9, 3.770385968182845*^9}, {
  3.770386064442906*^9, 3.7703860706029134`*^9}, {3.7703864745731688`*^9, 
  3.770386514673156*^9}, {3.770386627063263*^9, 3.770386630353235*^9}, {
  3.770386684313271*^9, 3.7703867049733377`*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[26]:=",ExpressionUUID->"478acc2c-8a6c-4282-91cc-96b0ea7d3f2e"],

Cell[BoxData[
 FractionBox[
  SuperscriptBox["\[ExponentialE]", 
   RowBox[{
    RowBox[{"-", 
     FractionBox["2", "3"]}], " ", 
    RowBox[{"(", 
     RowBox[{
      SuperscriptBox["x", "2"], "-", 
      FractionBox[
       RowBox[{"x", " ", "y"}], "2"], "+", 
      FractionBox[
       SuperscriptBox["y", "2"], "4"]}], ")"}]}]], 
  RowBox[{"2", " ", 
   SqrtBox["3"], " ", "\[Pi]"}]]], "Input",
 CellChangeTimes->{3.779233444774505*^9},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[27]:=",ExpressionUUID->"3d6d3b40-5302-4122-b061-68ed8dbd2ee4"],

Cell[BoxData[
 RowBox[{"fy", "=", 
  RowBox[{
   SubsuperscriptBox["\[Integral]", 
    RowBox[{"-", "\[Infinity]"}], "\[Infinity]"], 
   RowBox[{"f", 
    RowBox[{"\[DifferentialD]", "x"}]}]}]}]], "Input",
 CellChangeTimes->{{3.770385995042859*^9, 3.7703860349230843`*^9}, 
   3.770386190582985*^9, {3.77038668433327*^9, 3.7703866857133093`*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[28]:=",ExpressionUUID->"0bd960c9-b4d0-4b3d-9fb0-009676c608e9"],

Cell[BoxData[
 RowBox[{"Exy", "=", 
  RowBox[{
   SubsuperscriptBox["\[Integral]", 
    RowBox[{"-", "\[Infinity]"}], "\[Infinity]"], 
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      SubsuperscriptBox["\[Integral]", 
       RowBox[{"-", "\[Infinity]"}], "\[Infinity]"], 
      RowBox[{
       RowBox[{
        RowBox[{"Abs", "[", 
         RowBox[{"x", "+", "y"}], "]"}], " ", "f"}], 
       RowBox[{"\[DifferentialD]", "x"}]}]}], ")"}], 
    RowBox[{"\[DifferentialD]", "y"}]}]}]}]], "Input",
 CellChangeTimes->{{3.770386873203436*^9, 3.770386967953492*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[29]:=",ExpressionUUID->"2d04c5fa-f451-45f6-b59a-dc01f4a0b1fd"],

Cell[BoxData[
 RowBox[{"N", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.770387032083542*^9, 3.770387035293543*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[30]:=",ExpressionUUID->"651eefb9-95f9-429e-8be5-6ea6bcb24fa7"],

Cell[BoxData[
 RowBox[{"P", "=", 
  RowBox[{
   SubsuperscriptBox["\[Integral]", 
    RowBox[{"-", "\[Infinity]"}], "0"], 
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      SubsuperscriptBox["\[Integral]", 
       RowBox[{"-", "\[Infinity]"}], "0"], 
      RowBox[{"f", 
       RowBox[{"\[DifferentialD]", "x"}]}]}], ")"}], 
    RowBox[{"\[DifferentialD]", "y"}]}]}]}]], "Input",
 CellChangeTimes->{{3.7703870627635612`*^9, 3.7703871017435837`*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[31]:=",ExpressionUUID->"7e18e88b-2a8a-43f0-9907-939e18adb6c5"],

Cell[BoxData[
 RowBox[{"N", "[", "%", "]"}]], "Input",
 CellChangeTimes->{{3.77038745355382*^9, 3.7703874660538282`*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[32]:=",ExpressionUUID->"ecbe953c-1b47-45b3-9aa2-791266a53290"],

Cell["\<\
=======================================P98 \
\:5b9e\:9a8c1=======================================\
\>", "Text",
 CellChangeTimes->{{3.770542694031025*^9, 3.7705426982827168`*^9}, {
  3.7705427626892104`*^9, 3.7705427653740587`*^9}},
 FontFamily->"Consolas",
 FontSize->16,ExpressionUUID->"51562f91-ce49-4635-b12e-7e9e26a0cd47"],

Cell[BoxData[{
 RowBox[{
  RowBox[{"n", "=", "100000"}], ";"}], "\n", 
 RowBox[{
  RowBox[{"na", "=", "0"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"l", "=", "10"}], ";"}], "\n", 
 RowBox[{
  RowBox[{"d", "=", 
   RowBox[{"Table", "[", 
    RowBox[{
     RowBox[{"RandomReal", "[", 
      RowBox[{"{", 
       RowBox[{
        RowBox[{"-", "l"}], ",", "l"}], "}"}], "]"}], ",", "n"}], "]"}]}], 
  ";"}], "\n", 
 RowBox[{
  RowBox[{"\[Theta]", "=", 
   RowBox[{"Table", "[", 
    RowBox[{
     RowBox[{"RandomReal", "[", 
      RowBox[{"{", 
       RowBox[{"0", ",", "\[Pi]"}], "}"}], "]"}], ",", "n"}], "]"}]}], 
  ";"}], "\n", 
 RowBox[{
  RowBox[{"dist", "=", 
   RowBox[{
    RowBox[{"Abs", "[", "d", "]"}], "-", 
    RowBox[{
     FractionBox["1", "2"], " ", "l", " ", 
     RowBox[{"Sin", "[", "\[Theta]", "]"}]}]}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"Attributes", "[", "Less", "]"}], "=", 
   RowBox[{"{", "Listable", "}"}]}], ";"}], "\n", 
 RowBox[{
  RowBox[{
   RowBox[{"dist", "<", "0"}], "  ", "/.", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"True", "\[Rule]", "1"}], ",", 
     RowBox[{"False", "\[Rule]", "0"}]}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"n", "/", 
   RowBox[{"Total", "[", "%", "]"}]}], " ", "//", "N"}]}], "Input",
 CellChangeTimes->{{3.7705434020931625`*^9, 3.770543451693185*^9}, {
  3.7705436395541096`*^9, 3.7705436404299603`*^9}, {3.770543763398034*^9, 
  3.770543902248926*^9}, {3.7705440087430534`*^9, 3.770544013827791*^9}, {
  3.7705442717262*^9, 3.7705442722118826`*^9}, {3.7705445898391943`*^9, 
  3.770544614537985*^9}, {3.7705453053079596`*^9, 3.770545307123209*^9}, {
  3.770546124912526*^9, 3.770546240549882*^9}, {3.770546281635085*^9, 
  3.77054628240658*^9}, {3.770653641170722*^9, 3.7706537045404973`*^9}},
 FontFamily->"Consolas",
 FontSize->16,
 FontWeight->"Plain",
 CellLabel->"In[33]:=",ExpressionUUID->"c8a27175-2c24-4818-a53f-cece929d8e91"]
},
WindowSize->{1920, 997},
WindowMargins->{{-8, Automatic}, {Automatic, -8}},
FrontEndVersion->"11.3 for Microsoft Windows (64-bit) (2018\:5e743\:670828\
\:65e5)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 561, 9, 34, "Text",ExpressionUUID->"1ba9a391-4d02-4abc-aea9-35820373b23b"],
Cell[1122, 31, 335, 7, 34, "Text",ExpressionUUID->"4f6e74e8-eac4-48f5-aa94-2c5337ad9aa8"],
Cell[1460, 40, 513, 11, 51, "Input",ExpressionUUID->"d423477c-4efb-47e7-8a8a-cfc0e79020fb"],
Cell[1976, 53, 294, 7, 51, "Input",ExpressionUUID->"b86926e4-2334-4ce1-a42e-df965f9feaaf"],
Cell[2273, 62, 296, 7, 51, "Input",ExpressionUUID->"5bc41594-3027-42fc-94de-33ac95ef205c"],
Cell[2572, 71, 638, 16, 51, "Input",ExpressionUUID->"559e37d9-a1da-4ca4-90ed-074820f5c2ab"],
Cell[3213, 89, 438, 8, 34, "Text",ExpressionUUID->"5e090374-d7b1-4014-a4b8-3580c62b3afc"],
Cell[3654, 99, 896, 23, 51, "Input",ExpressionUUID->"b5384d2f-a3f1-46df-8758-7c4940ac3474"],
Cell[4553, 124, 414, 9, 34, "Text",ExpressionUUID->"924d08b1-a02d-45f1-8145-341282083d12"],
Cell[4970, 135, 835, 23, 68, "Input",ExpressionUUID->"478acc2c-8a6c-4282-91cc-96b0ea7d3f2e"],
Cell[5808, 160, 582, 19, 73, "Input",ExpressionUUID->"3d6d3b40-5302-4122-b061-68ed8dbd2ee4"],
Cell[6393, 181, 487, 12, 51, "Input",ExpressionUUID->"0bd960c9-b4d0-4b3d-9fb0-009676c608e9"],
Cell[6883, 195, 702, 20, 69, "Input",ExpressionUUID->"2d04c5fa-f451-45f6-b59a-dc01f4a0b1fd"],
Cell[7588, 217, 261, 6, 51, "Input",ExpressionUUID->"651eefb9-95f9-429e-8be5-6ea6bcb24fa7"],
Cell[7852, 225, 590, 17, 53, "Input",ExpressionUUID->"7e18e88b-2a8a-43f0-9907-939e18adb6c5"],
Cell[8445, 244, 262, 6, 51, "Input",ExpressionUUID->"ecbe953c-1b47-45b3-9aa2-791266a53290"],
Cell[8710, 252, 337, 7, 34, "Text",ExpressionUUID->"51562f91-ce49-4635-b12e-7e9e26a0cd47"],
Cell[9050, 261, 1968, 57, 361, "Input",ExpressionUUID->"c8a27175-2c24-4818-a53f-cece929d8e91"]
}
]
*)

